package uk.ac.ebi.bioinvindex.model.impl.xref;

import uk.ac.ebi.bioinvindex.model.impl.HasReferencesImpl;
import uk.ac.ebi.bioinvindex.model.impl.IdentifiableImpl;

import javax.persistence.Column;
import javax.persistence.MappedSuperclass;
import javax.persistence.Transient;

/**
 * User: Nataliya Sklyar (nsklyar@ebi.ac.uk)
 * Date: Jul 11, 2007
 */
@MappedSuperclass
public abstract class XrefImpl<Owner extends HasReferencesImpl>
	extends IdentifiableImpl
{

	private String acc;

	@Column (name = "ACC", unique = true)
	public String getAcc () {
		return this.acc;
	}

	public void setAcc (String acc) {
		this.acc = acc;
	}


	private Owner owner;

	@Transient
	public HasReferencesImpl getOwner() {
		return owner;
	}

  public void setOwner(Owner owner) {
		this.owner = owner;
	}

	private ReferenceSourceImpl source;

	@Transient
	public ReferenceSourceImpl getSource () {
		return this.source;
	}

	public void setSource (ReferenceSourceImpl source) {
		this.source = source;
	}

	public String toString () {
		return String.format ( "{%s: #%s, acc:%s}" , getClass().getSimpleName (), getId (), getAcc () );
	}

}
